//
//  MainViewController.swift
//  Weibo
//
//  Created by 孙国强 on 2017/6/18.
//  Copyright © 2017年 孙国强. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {

    fileprivate lazy var composeBtn : UIButton = UIButton(imageName: "tabbar_compose_icon_add", bgImageName: "tabbar_compose_button")
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        setupComposeBtn()
        
    }

}

extension MainViewController {
    // 设置发布按钮
    fileprivate func setupComposeBtn() {
        
        tabBar.addSubview(composeBtn)
        
        composeBtn.center = CGPoint(x: tabBar.center.x, y: tabBar.bounds.height * 0.5)
        
        composeBtn .addTarget(self, action: #selector(MainViewController.composeClick), for: .touchUpInside)
        
    }
}

extension MainViewController {
    @objc fileprivate func composeClick() {
        let composeVC = ComposeViewController()
        let composeNav = UINavigationController(rootViewController: composeVC)
        present(composeNav, animated: true, completion: nil)
    }
}
